'''
Created on 10/04/2010

@author: User
'''
from google.appengine.api import users
from Models import DTO,KnownUser


class LogService:
    def logOut(self, accessUrl):
        url = users.create_logout_url(accessUrl)
        return url
    
    def getNickname(self):
        dto = DTO()
        known = KnownUser.gql("WHERE kuser = :1", users.get_current_user()).get()
        if known.isNew:
            known.isNew = False
            known.put()
            dto.isKnown = False
        else:
            dto.isKnown = True        
        dto.nickname = users.get_current_user().nickname()
        return dto
